package leetcode;

public class LeetCode92 {
    public ListNode reverseBetween1(ListNode head, int m, int n) {
        ListNode p = head, pre = head, next, last;
        int i = 0;
        while (i != n) {
            if (i < m) {
                pre = p;
                p = p.next;
            } else {
                next = p.next;
                last = p.next.next;
                p.next = last;
                pre.next = next;
                next.next = p;
                p = last;
            }
            i++;
        }
        return head;
    }

    //一次遍历翻转
    public ListNode reverseBetween(ListNode head, int m, int n) {
        return null;
    }
}
